package com.ruoyi.order.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.Greenhouse;
import com.ruoyi.order.mapper.GreenhouseMapper;
import com.ruoyi.order.service.IGreenhouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 大棚管理Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-11
 */
@Service
public class GreenhouseServiceImpl implements IGreenhouseService
{
    @Autowired
    private GreenhouseMapper greenhouseMapper;

    /**
     * 查询大棚管理
     *
     * @param greenhouseId 大棚管理ID
     * @return 大棚管理
     */
    @Override
    public Greenhouse selectGreenhouseById(Long greenhouseId)
    {
        return greenhouseMapper.selectGreenhouseById(greenhouseId);
    }

    /**
     * 查询大棚管理列表
     *
     * @param greenhouse 大棚管理
     * @return 大棚管理
     */
    @Override
    public List<Greenhouse> selectGreenhouseList(Greenhouse greenhouse)
    {
        return greenhouseMapper.selectGreenhouseList(greenhouse);
    }

    /**
     * 新增大棚管理
     *
     * @param greenhouse 大棚管理
     * @return 结果
     */
    @Override
    public int insertGreenhouse(Greenhouse greenhouse)
    {
        greenhouse.setCreateTime(DateUtils.getNowDate());
        return greenhouseMapper.insertGreenhouse(greenhouse);
    }

    /**
     * 修改大棚管理
     *
     * @param greenhouse 大棚管理
     * @return 结果
     */
    @Override
    public int updateGreenhouse(Greenhouse greenhouse)
    {
        greenhouse.setUpdateTime(DateUtils.getNowDate());
        return greenhouseMapper.updateGreenhouse(greenhouse);
    }

    /**
     * 批量删除大棚管理
     *
     * @param greenhouseIds 需要删除的大棚管理ID
     * @return 结果
     */
    @Override
    public int deleteGreenhouseByIds(Long[] greenhouseIds)
    {
        return greenhouseMapper.deleteGreenhouseByIds(greenhouseIds);
    }

    /**
     * 删除大棚管理信息
     *
     * @param greenhouseId 大棚管理ID
     * @return 结果
     */
    @Override
    public int deleteGreenhouseById(Long greenhouseId)
    {
        return greenhouseMapper.deleteGreenhouseById(greenhouseId);
    }
}
